package ru.paswd.marketprice.rest.receipt.getter.http.local;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import ru.paswd.marketprice.rest.receipt.getter.api.ReceiptGetter;
import ru.paswd.marketprice.rest.receipt.getter.api.dto.Receipt;
import ru.paswd.marketprice.storage.receipt.api.ReceiptStorageApi;

@Component
@RequiredArgsConstructor
public class HttpLocalReceiptGetter implements ReceiptGetter {
    private final ReceiptStorageApi receiptStorageApi;
    private final ReceiptMapper mapper;

    @Override
    public Receipt get(String fiscalNumber, String fiscalSign, String fiscalDocumentNumber) {
        return mapper.mapReceiptFromStorage(receiptStorageApi.getReceiptByParams(fiscalNumber, fiscalSign, fiscalDocumentNumber));
    }
}
